/*
 *    Copyright 2008 Lammert Westerhoff
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.maven.plugins.dependencyconflicts;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import org.apache.maven.shared.dependency.tree.DependencyNode;

/**
 * Default implementation of {@link DependencyConflicts}. This implementation is using three sets received by the
 * constructor which contents are copied into unmodifiable sets.
 * 
 * @author Lammert Westerhoff
 */
public class DefaultDependencyConflicts
    implements DependencyConflicts
{

    private Set<DependencyNode> errorConflicts;

    private Set<DependencyNode> infoConflicts;

    private Set<DependencyNode> warningConflicts;

    /**
     * Construct a <code>DefaultDependencyConflicts<code>.
     * 
     * @param errorConflicts the set with error dependency conflicts
     * @param warningConflicts the set with warning dependency conflicts
     * @param infoConflicts the set with info dependency conflicts
     */
    public DefaultDependencyConflicts( final Set<DependencyNode> errorConflicts,
                                       final Set<DependencyNode> warningConflicts,
                                       final Set<DependencyNode> infoConflicts )
    {
        super();
        this.errorConflicts = Collections.unmodifiableSet( new HashSet<DependencyNode>( errorConflicts ) );
        this.warningConflicts = Collections.unmodifiableSet( new HashSet<DependencyNode>( warningConflicts ) );
        this.infoConflicts = Collections.unmodifiableSet( new HashSet<DependencyNode>( infoConflicts ) );
    }

    /*
     * (non-Javadoc)
     * @see com.googlecode.maven.plugins.dependencyconflicts.DependencyConflicts#getErrorConflicts()
     */
    @Override
    public Set<DependencyNode> getErrorConflicts()
    {
        return this.errorConflicts;
    }

    /*
     * (non-Javadoc)
     * @see com.googlecode.maven.plugins.dependencyconflicts.DependencyConflicts#getInfoConflicts()
     */
    @Override
    public Set<DependencyNode> getInfoConflicts()
    {
        return this.infoConflicts;
    }

    /*
     * (non-Javadoc)
     * @see com.googlecode.maven.plugins.dependencyconflicts.DependencyConflicts#getWarningConflicts()
     */
    @Override
    public Set<DependencyNode> getWarningConflicts()
    {
        return this.warningConflicts;
    }

}
